/****** Object:  Stored Procedure dbo.spr_LoadDBCarsByPK  ******/

 use [TourIS]
 GO

 if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spr_LoadDBCarsByPK]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
 drop procedure [dbo].[spr_LoadDBCarsByPK]
 GO

 SET QUOTED_IDENTIFIER OFF
 GO
 SET ANSI_NULLS OFF
 GO

 CREATE  PROCEDURE [dbo].[spr_LoadDBCarsByPK]
 (
	@carid int,
	@compid int
 )
 AS

 BEGIN
	SET NOCOUNT ON
	DECLARE @Err int

	SELECT
		[CarId],
		[CompId],
		[Details],
		[GarageVisitReading],
		[Is3rdParty],
		[IsActive],
		[IsAuto],
		[LastGarageVisit],
		[LastOilChecked],
		[LastTyreChange],
		[Make],
		[Model],
		[OilChangeReading],
		[PurchaseDate],
		[RegNo],
		[TyreChangeReading]
		FROM [Cars]
	WHERE
	[CarId] = @carid
	AND [CompId] = @compid


	SET @Err = @@Error
	RETURN @Err
 END

 GO

 SET QUOTED_IDENTIFIER OFF
 GO
 SET ANSI_NULLS ON
 GO

